<?php
class WDiskBrands extends CWidget {
	var $skin = 'defaultDisks';
	var $options = array();
	protected $data = array();
	
	public function init(){
		$default = array(
			'limit' => 6,
		);
		$this->options = array_merge($default, $this->options);
		
		$criteria = new CDbCriteria;
		/*
		// Сезонность
		if($season && L::r_item('tyreSeason', $season))
			$criteria->addCondition('tyres.season = '.L::r_item('tyreSeason', $season));

		// Шипованность			
		if($stud == 'studded')
			$criteria->addCondition('tyres.stud = 1');
		if($stud == 'not_studded')
			$criteria->addCondition('tyres.stud = 0');
		*/
			
		$criteria->addCondition('sizes.rest <> "0"');
			
		$criteria->with = array('disks.sizes');
		$criteria->order = 't.title';
		$this->data = DiskProducers::model()->findAll($criteria);
		
		return parent::init();
	}
	
	public function run(){
		$this->render($this->skin, array('options'=>$this->options, 'data'=>$this->data));
	}
}